package prv.creational.prototype;

/**
 * Implementation of prototype class
 */
class PrototypeImpl implements Prototype, Cloneable {
	private int x;

	/**
	 * Constructor
	 */
	public PrototypeImpl(int x) {
		setX(x);
	}

	@Override
	public void setX(int x) {
		this.x = x;
	}

	@Override
	public void printX() {
		System.out.println("Value: " + x);
	}

	@Override
	public int getX() {
		return x;
	}

	@Override
	public PrototypeImpl clone() {
		try {
			return (PrototypeImpl) super.clone();
		} catch (CloneNotSupportedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
